/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package model;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author ivanhoe
 */
@Entity
@Table(name = "estado_orden")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "EstadoOrden.findAll", query = "SELECT e FROM EstadoOrden e"),
    @NamedQuery(name = "EstadoOrden.findByIdEstadoOrden", query = "SELECT e FROM EstadoOrden e WHERE e.idEstadoOrden = :idEstadoOrden"),
    @NamedQuery(name = "EstadoOrden.findByNombreEstado", query = "SELECT e FROM EstadoOrden e WHERE e.nombreEstado = :nombreEstado")})
public class EstadoOrden implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "id_estado_orden")
    private Integer idEstadoOrden;
    @Size(max = 45)
    @Column(name = "nombre_estado")
    private String nombreEstado;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idEstadoOrden")
    private Collection<OrdenesTrabajo> ordenesTrabajoCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "estadoOrden")
    private Collection<OrdenesHasEstado> ordenesHasEstadoCollection;

    public EstadoOrden() {
    }

    public EstadoOrden(Integer idEstadoOrden) {
        this.idEstadoOrden = idEstadoOrden;
    }

    public Integer getIdEstadoOrden() {
        return idEstadoOrden;
    }

    public void setIdEstadoOrden(Integer idEstadoOrden) {
        this.idEstadoOrden = idEstadoOrden;
    }

    public String getNombreEstado() {
        return nombreEstado;
    }

    public void setNombreEstado(String nombreEstado) {
        this.nombreEstado = nombreEstado;
    }

    @XmlTransient
    public Collection<OrdenesTrabajo> getOrdenesTrabajoCollection() {
        return ordenesTrabajoCollection;
    }

    public void setOrdenesTrabajoCollection(Collection<OrdenesTrabajo> ordenesTrabajoCollection) {
        this.ordenesTrabajoCollection = ordenesTrabajoCollection;
    }

    @XmlTransient
    public Collection<OrdenesHasEstado> getOrdenesHasEstadoCollection() {
        return ordenesHasEstadoCollection;
    }

    public void setOrdenesHasEstadoCollection(Collection<OrdenesHasEstado> ordenesHasEstadoCollection) {
        this.ordenesHasEstadoCollection = ordenesHasEstadoCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idEstadoOrden != null ? idEstadoOrden.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof EstadoOrden)) {
            return false;
        }
        EstadoOrden other = (EstadoOrden) object;
        if ((this.idEstadoOrden == null && other.idEstadoOrden != null) || (this.idEstadoOrden != null && !this.idEstadoOrden.equals(other.idEstadoOrden))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "model.EstadoOrden[ idEstadoOrden=" + idEstadoOrden + " ]";
    }
    
}
